#ifndef _NE_VERTEX_DATA_H_
#define _NE_VERTEX_DATA_H_

#include <graphics/VertexAttribute.h>

namespace ne
{
    class NEAPI VertexData
    {
        public:
            explicit VertexData(const PrimitiveType pt);

            PrimitiveType getPrimitiveType() const;

            void setStride(const uint32_t stride);

            uint32_t getStride() const;

            VertexAttributePtr createAttribute(const uint32_t bufferSource,
                                               const AttributeSemantic semantic,
                                               const AttributeType type,
                                               const uint32_t count,
                                               const uint32_t stride,
                                               const size_t offset,
                                               const bool normalized=false);

            bool hasAttribute(const AttributeSemantic semantic) const;

            VertexAttributePtr getAttribute(const AttributeSemantic semantic) const;

            uint32_t getSize() const;

            uint32_t getAttributeCount() const;

            const VertexAttributeMap& getAttributeMap() const;

            bool removeAttribute(VertexAttributePtr &pAttribute);

            bool removeAttribute(const AttributeSemantic semantic);

            void removeAll();

            void needUpdateSize();

            ~VertexData();

        private:
            void _updateSize() const;

            VertexData();

            VertexData(const VertexData &);

            VertexData& operator = (const VertexData &);

        private:
            PrimitiveType mPrimitiveType;
            uint32_t mStride;
            VertexAttributeMap mAttributeMap;

            mutable uint32_t mSize;
            mutable bool mNeedSizeUpdate;
    };

    typedef SharedPtr<VertexData> VertexDataPtr;
}

#endif
